package com.ldx.blog.pojo.request;

import com.ldx.blog.pojo.dataobject.BlogInfo;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.beans.BeanUtils;

@Data
public class UpdateBlogRequest {
    @NotNull(message = "博客id不能为空")
    private Integer id;
    private String title;
    private String content;

    public static BlogInfo trans(UpdateBlogRequest blogRequest){
        if(blogRequest==null){
            return null;
        }
        BlogInfo blogInfo = new BlogInfo();
        BeanUtils.copyProperties(blogRequest,blogInfo);
        return blogInfo;
    }
}
